﻿using System;
using System.Windows.Forms;
using System.IO;
using Core;

namespace TestProject
{
    public partial class CreationForm : Form
    {
        private MainWindow mw;
        public CreationForm(MainWindow mw)
        {
            InitializeComponent();
            this.mw = mw;
        }

        private void create_button_Click(object sender, EventArgs e)
        {
            string model_path = "file_input\\" + name_box.Text+"\\"+name_box.Text+".xml";
            if (Directory.Exists("file_input\\" + name_box.Text))
            {
                MessageBox.Show("Model with this name already exists. Please, choose another name.");
                return;
            }
                mw.model = new Model(model_path);             
            this.Close();
        }

        private void canc_creat_butt_Click(object sender, EventArgs e)
        {
            this.Close();
        }        
    }
}

